package main

import (
	"fmt"
)

//#link: https://leetcode-cn.com/problems/latest-time-by-replacing-hidden-digits/
func main() {
	time := "2?:?0"
	fmt.Println(maximumTime(time))
}

func maximumTime(time string) string {
	sByte := []byte(time)
	for i, v := range sByte {
		if v == '?' {
			if i == 0 {
				if sByte[1] == '?' || sByte[1] < '4' {
					sByte[i] = '2'
				} else {
					sByte[i] = '1'
				}
				continue
			}
			if i == 1 {
				if sByte[0] == '2' {
					sByte[i] = '3'
				} else {
					sByte[i] = '9'
				}
				continue
			}

			if i == 3 {
				sByte[i] = '5'
				continue
			}
			if i == 4 {
				sByte[i] = '9'
				continue
			}
		}
	}
	return string(sByte)
}
